package com.archerdu.base.mail.model;

import java.util.Properties;

import com.archerdu.base.mail.IServerInfo;

public class ServerInfo implements IServerInfo {

    private String  serverHost;
    private String  serverPort;
    private boolean validate;
    private String  userName;
    private String  password;
    private String  fromAddress;

    @Override
    public String getServerHost() {
        return serverHost;
    }

    @Override
    public String getServerPort() {
        return serverPort;
    }

    @Override
    public boolean isValidate() {
        return validate;
    }

    @Override
    public String getUserName() {
        return userName;
    }

    @Override
    public String getPassword() {
        return password;
    }

    @Override
    public String getFromAddress() {
        return fromAddress;
    }

    @Override
    public Properties getProperties() {
        Properties p = new Properties(); 
        p.put("mail.smtp.host", getServerHost()); 
        p.put("mail.smtp.port", getServerPort()); 
        p.put("mail.smtp.auth", isValidate() ? "true" : "false"); 
        return p; 
    }

    public void setServerHost(String serverHost) {
        this.serverHost = serverHost;
    }

    public void setServerPort(String serverPort) {
        this.serverPort = serverPort;
    }

    public void setValidate(boolean validate) {
        this.validate = validate;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public void setFromAddress(String fromAddress) {
        this.fromAddress = fromAddress;
    }

}
